package com.itheima.consumer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {

    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("hmall.direct2");
    }

    @Bean
    public Queue directQueue3() {
        return new Queue("direct2.queue3");
    }

    @Bean
    public Queue directQueue4() {
        return new Queue("direct2.queue4");
    }

    @Bean
    public Binding directBindingQueue3Red() {
        return BindingBuilder.bind(directQueue3()).to(directExchange()).with("red");
    }

    @Bean
    public Binding directBindingQueue3Blue() {
        return BindingBuilder.bind(directQueue3()).to(directExchange()).with("blue");
    }

    @Bean
    public Binding directBindingQueue4Red() {
        return BindingBuilder.bind(directQueue4()).to(directExchange()).with("red");
    }

    @Bean
    public Binding directBindingQueue4Yellow() {
        return BindingBuilder.bind(directQueue4()).to(directExchange()).with("yellow");
    }
}
